import random
import time

import schedule

from basketballFull import basketballFull
from footballFull import footballFull
from footballSimple import footballSimple

nba = 'http://lq3.titan007.com/nba.htm'
football = "http://live.titan007.com/oldIndexall.aspx"


def job():
    if __name__ == '__main__':
        run2 = basketballFull(nba)
        run2.main()
        run1 = footballFull(football)
        run1.main()
        run3 = footballSimple(football)
        run3.main()


# 这里选择每10秒运行一次上面的函数。
schedule.every(10).seconds.do(job)

# 这一步是必须的，运行schedule
try:
    while True:
        schedule.run_pending()
        time.sleep(600)
except Exception:
    time.sleep(100)
    while True:
        schedule.run_pending()
        time.sleep(300)
